package code.tools.behavior
{
	import code.main.core.mvc.YController;
	import code.structure.module.scene.model.data.SpendData;
	import code.untils.CommandNameConst;
	
	import com.patience.mvc.context.Command;
	
	import flash.display.DisplayObject;
	import flash.geom.Point;

	/**
	 *@author CYoung
	 * 减值动画
	 */
	public class DelValueAnimation extends YController
	{
		/**
		 *播放扣值(coins, cash, ...)动画 
		 * @param target 目标位置
		 * @param value 值
		 * @param type  值的类型
		 * @return 命令 
		 */		
		public static function delValue(target:DisplayObject, value:int, type:int, offx:int = 0, offy:int = 0):Command
		{
			/* 货币减少的动画  */
			var pay:SpendData = new SpendData(value, type);
			var point:Point = target.localToGlobal(new Point(0,0));
			pay.x = point.x + offx;
			pay.y = point.y + offy;
			var c:Command = new Command(CommandNameConst.COMMAND_PANEL_PAY);
			c.data = pay;
			return c;
		}
	}
}